package com.meatball.iot.driver.doormagnet.util

import com.alibaba.fastjson.parser.DefaultJSONParser
import com.alibaba.fastjson.parser.deserializer.ObjectDeserializer
import com.meatball.iot.driver.doormagnet.enums.Cmd
import java.lang.reflect.Type

/**
 * TODO 定义专用序列化实现
 *
 * @author 张翔宇
 * @since 2024年6月18日
 *
 */
/*
class CmdDeserializer : ObjectDeserializer {
    override fun <T> deserialze(parser: DefaultJSONParser, type: Type, fieldName: Any?): T {
        val value = parser.parseObject(Int::class.java)
        val cmd = Cmd.entries.find { it.value == value } ?: Cmd.UNKNOWN_EVENT
        @Suppress("UNCHECKED_CAST")
        return cmd as T
    }

    override fun getFastMatchToken(): Int {
        return 0
    }
}*/
